package com.gky.gkytemplate.common.enums;

import cn.hutool.core.util.ObjectUtil;

/**
 * 文件上传的类型
 */
public enum FileUploadEnum {

    USER_AVATAR("用户头像","user_avatar",1024*1024L);

    //文件描述
    private final String text;

    //文件类型
    private final String value;

    //文件最大大小
    private final Long fileSize;

    FileUploadEnum(String text, String value, Long fileSize) {
        this.text = text;
        this.value = value;
        this.fileSize = fileSize;
    }

    public static FileUploadEnum getEnumByValue(String value){
        if (ObjectUtil.isEmpty(value)){
            return null;
        }
        for (FileUploadEnum anEnum: FileUploadEnum.values()){
            if (anEnum.value.equals(value)){
                return anEnum;
            }
        }
        return null;
    }


    public String getText() {
        return text;
    }

    public String getValue() {
        return value;
    }

    public Long getFileSize() {
        return fileSize;
    }
}
